var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  var articles;
  req.collections.articles.find({}).toArray(function(err,docs){
    if(err)
      return next(err);
    res.render('index', { title: 'Mongo Blog' , articles: docs});
  });

});

module.exports = router;
